import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/hello")
public class Servlet_HelloWorld extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //在Servlet控制台打印“hello world”
        System.out.println("hello world");
        //在网页上显示“hello world“ 把字符串作为http响应的body部分
        resp.getWriter().write("hello world");
    }
}
